package com.springbootsys.service.impl;

import com.springbootsys.entity.User;
import com.springbootsys.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserServiceImpl{
    @Resource
    private UserMapper userMapper;

    @PostMapping("getUserInfo")
    public User getUserInfo(@RequestBody User user) {
        User userInfo = userMapper.getUserInfo(user);
        return userInfo;
    }

    @GetMapping("loadUserByUsername")
    public User loadUserByUsername(@RequestParam("s") String s) {
        return userMapper.loadUserByUsername(s);
    }

    @GetMapping("getAllUsers")
    public List<User> getAllUsers() {
        return userMapper.getAllUsers();
    }

}
